package com.robert.mymvp.model;

import com.robert.mvp.base.MvpListener;
import com.robert.mvp.net.MyListener;
import com.robert.mvp.net.RequestManager;
import com.robert.mymvp.bean.DailyBean;
import com.robert.mymvp.contract.DailyContract;

import java.util.List;

/**
 * Des:
 *
 * @Author: cpf
 * @date: ${date} ${hour} ${minute}
 * @email: 2227039052@qq.com
 */
public class DailyModelImpl implements DailyContract.DailyModel {
    @Override
    public void loadDaily(String url, final MvpListener<List<DailyBean.StoriesBean>> listener) {
        RequestManager.getInstance().sendGet(url, DailyBean.class, new MyListener<DailyBean>() {
            @Override
            public void onSuccess(DailyBean result) {
                listener.onSuccess(result.getStories());
            }

            @Override
            public void onError(String errorMsg) {
                listener.onError(errorMsg);
            }
        });
    }
}
